package com.disapand.mybaby.configuration;

import com.disapand.mybaby.interceptor.ApiIdempotentInterceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author disapand
 */
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {

    @Bean
    public ApiIdempotentInterceptor apiIdempotentInterceptor() {
        return new ApiIdempotentInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(apiIdempotentInterceptor());
        // super.addInterceptors(registry);
    }
    
}
